#ifndef HIR_INSTRSTORAGE_HPP
#define HIR_INSTRSTORAGE_HPP
#pragma once

namespace hir
{

class InstrStorage
{
public:
    typedef std::vector<std::unique_ptr<Instruction> > GraphStoreage;

    inline GraphStoreage &  storage()
    {
        return storage_;
    }
    inline uint32_t graphId() const
    {
        return currentGraphId_;
    }
    inline uint32_t graphIdAndInc()
    {
        return currentGraphId_++;
    }
    inline Instruction * operator [] (uint32_t index)
    {
        return storage_[index].get();
    }

    inline void push_back(GraphStoreage::value_type & v)
    {
        storage_.push_back(std::move(v));
    }

    inline size_t size() const
    {
        return storage_.size();
    }

private:
    GraphStoreage storage_;
    uint32_t currentGraphId_;
};

}

#endif /* HIR_INSTRSTORAGE_HPP */
